home *** CD-ROM | disk | FTP | other *** search
- // dice.lib function two_dice()
- #include <dos.h>
- #include <iostream.h>
- #include <stdlib.h>
-
- int two_dice(int size,int time,int disp1,int disp2,char string3[30])
- {
- int dice1,dice2,sumdice,j;
-
- for (j=1;j<=10;j++) {
- dice1 = 1 + rand() % size;
- dice2 = 1 + rand() % size;
- sumdice=dice1+dice2;
- if (disp1 == 0 && disp2 == 0)
- cout<<string3<<"?? + ?? = ?? \r";
- else if (disp1 == 0 && disp2 == 1)
- cout<<string3<<"?? + ?? = "<<sumdice<<" \r";
- if (disp1 == 1 && disp2 == 0)
- cout<<string3<<dice1<<" + "<<dice2<<" = ?? \r";
- else if (disp1 == 1 && disp2 == 1)
- cout<<string3<<dice1<<" + "<<dice2<<" = "<<sumdice<<" \r";
- delay(time);
- }
- return sumdice;
- }